<template>
  <view class="profile-page">
    <!-- 顶部导航栏 -->
    <view class="header-nav">
      <view class="nav-content">
        <text class="nav-title">我的</text>
        <view class="nav-actions">
          <text class="iconfont-v2 icon-shezhi action-icon"></text>
        </view>
      </view>
    </view>

    <!-- 用户信息区域 -->
    <view class="user-info-section">
      <view class="user-avatar-container">
        <image 
          :src="userInfo.avatar" 
          class="user-avatar"
          mode="aspectFill"
        />
        <view class="merchant-tag">商家</view>
      </view>
      
      <view class="user-details">
        <text class="username">{{ userInfo.username }}</text>
        <view class="edit-profile" @click="editProfile">
          <text>编辑资料</text>
          <text class="iconfont-v2 icon-arrow-right"></text>
        </view>
      </view>
      
      <!-- 统计数据 -->
      <view class="stats-container">
        <view class="stat-item">
          <text class="stat-number">{{ userInfo.stats.onlineJobs }}</text>
          <text class="stat-label">在线职位</text>
        </view>
        <view class="stat-item">
          <text class="stat-number">{{ userInfo.stats.applicants }}</text>
          <text class="stat-label">报名人数</text>
        </view>
        <view class="stat-item">
          <text class="stat-number">{{ userInfo.stats.favorites }}</text>
          <text class="stat-label">收藏</text>
        </view>
      </view>
    </view>

    <!-- VIP会员区域 -->
    <view class="vip-section">
      <view class="vip-content">
        <view class="vip-info">
          <text class="iconfont-v2 icon-vip vip-icon"></text>
          <text class="vip-text">VIP会员</text>
        </view>
        <button class="upgrade-btn" @click="upgradeVip">升级会员</button>
      </view>
    </view>

    <!-- 订单快捷入口 -->
    <view class="order-section">
      <view class="order-item" @click="goToOrders('pending')">
        <view class="order-icon">
          <text class="iconfont-v2 icon-qianbao"></text>
        </view>
        <text class="order-label">待付款</text>
      </view>
      <view class="order-item" @click="goToOrders('paid')">
        <view class="order-icon">
          <text class="iconfont-v2 icon-qianbao"></text>
          <view class="badge">5</view>
        </view>
        <text class="order-label">已付款</text>
      </view>
      <view class="order-item" @click="goToOrders('all')">
        <view class="order-icon">
          <text class="iconfont-v2 icon-dingdan"></text>
        </view>
        <text class="order-label">全部订单</text>
      </view>
    </view>

    <!-- 其他服务 -->
    <view class="services-section">
      <text class="section-title">其他服务</text>
      <view class="services-grid">
        <view class="service-item" @click="refreshJobs">
          <view class="service-icon">
            <text class="iconfont-v2 icon-shuaxin"></text>
          </view>
          <text class="service-label">职位刷新</text>
        </view>
        <view class="service-item" @click="proactiveInvite">
          <view class="service-icon">
            <text class="iconfont-v2 icon-yaoqing"></text>
          </view>
          <text class="service-label">主动邀约</text>
        </view>
        <view class="service-item" @click="goToHelp">
          <view class="service-icon">
            <text class="iconfont-v2 icon-bangzhu"></text>
          </view>
          <text class="service-label">帮助中心</text>
        </view>
        <view class="service-item" @click="goToFeedback">
          <view class="service-icon">
            <text class="iconfont-v2 icon-fankui"></text>
          </view>
          <text class="service-label">意见反馈</text>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      userInfo: {
        avatar: 'http://www.dzgktf.com/templets/default/images/wtyt.jpg',
        username: '我饿老虎的抓子',
        stats: {
          onlineJobs: 1000,
          applicants: 128,
          favorites: 19
        }
      }
    }
  },
  methods: {
    editProfile() {
      uni.navigateTo({
        url: '/pages/bussiness/edit-profile'
      });
    },
    upgradeVip() {
      uni.navigateTo({
        url: '/pages/bussiness/vip-upgrade'
      });
    },
    goToOrders(type) {
      uni.navigateTo({
        url: `/pages/bussiness/order-list?type=${type}`
      });
    },
    refreshJobs() {
      uni.showModal({
        title: '职位刷新',
        content: '确定要刷新所有职位吗？这将提升职位的曝光度。',
        success: (res) => {
          if (res.confirm) {
            uni.showToast({
              title: '刷新成功',
              icon: 'success'
            });
          }
        }
      });
    },
    proactiveInvite() {
      uni.navigateTo({
        url: '/pages/bussiness/invite-list'
      });
    },
    goToHelp() {
      uni.navigateTo({
        url: '/pages/bussiness/help-center'
      });
    },
    goToFeedback() {
      uni.navigateTo({
        url: '/pages/bussiness/feedback'
      });
    }
  }
}
</script>

<style lang="scss" scoped>
.profile-page {
  min-height: 100vh;
  background: #f5f5f5;
}

/* 顶部导航栏 */
.header-nav {
  background: #ED6567;
  padding: 20rpx 30rpx;
  padding-top: calc(20rpx + env(safe-area-inset-top));
  
  .nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    
    .nav-title {
      font-size: 36rpx;
      font-weight: 600;
      color: white;
    }
    
    .nav-actions {
      .action-icon {
        font-size: 32rpx;
        color: white;
      }
    }
  }
}

/* 用户信息区域 */
.user-info-section {
  background: white;
  padding: 40rpx 30rpx;
  margin-bottom: 20rpx;
  
  .user-avatar-container {
    position: relative;
    display: flex;
    justify-content: center;
    margin-bottom: 30rpx;
    
    .user-avatar {
      width: 120rpx;
      height: 120rpx;
      border-radius: 50%;
      background: #f0f0f0;
    }
    
    .merchant-tag {
      position: absolute;
      top: -8rpx;
      right: calc(50% - 80rpx);
      background: #FFD700;
      color: #333;
      font-size: 20rpx;
      font-weight: 600;
      padding: 4rpx 12rpx;
      border-radius: 20rpx;
    }
  }
  
  .user-details {
    text-align: center;
    margin-bottom: 40rpx;
    
    .username {
      display: block;
      font-size: 32rpx;
      font-weight: 600;
      color: #333;
      margin-bottom: 12rpx;
    }
    
    .edit-profile {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8rpx;
      color: #666;
      font-size: 26rpx;
      cursor: pointer;
      
      .iconfont-v2 {
        font-size: 20rpx;
      }
    }
  }
  
  .stats-container {
    display: flex;
    justify-content: space-around;
    
    .stat-item {
      text-align: center;
      
      .stat-number {
        display: block;
        font-size: 36rpx;
        font-weight: 600;
        color: #ED6567;
        margin-bottom: 8rpx;
      }
      
      .stat-label {
        font-size: 24rpx;
        color: #666;
      }
    }
  }
}

/* VIP会员区域 */
.vip-section {
  background: linear-gradient(135deg, #ED6567 0%, #D55A54 100%);
  margin: 0 30rpx 20rpx;
  border-radius: 24rpx;
  padding: 30rpx;
  
  .vip-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    
    .vip-info {
      display: flex;
      align-items: center;
      gap: 12rpx;
      
      .vip-icon {
        font-size: 32rpx;
        color: white;
      }
      
      .vip-text {
        font-size: 28rpx;
        font-weight: 600;
        color: white;
      }
    }
    
    .upgrade-btn {
      background: rgba(255, 255, 255, 0.2);
      color: white;
      border: none;
      border-radius: 30rpx;
      padding: 16rpx 32rpx;
      font-size: 24rpx;
      cursor: pointer;
      transition: all 0.3s ease;
      
      &:hover {
        background: rgba(255, 255, 255, 0.3);
      }
    }
  }
}

/* 订单快捷入口 */
.order-section {
  background: white;
  margin: 0 30rpx 20rpx;
  border-radius: 24rpx;
  padding: 30rpx;
  display: flex;
  justify-content: space-around;
  
  .order-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    
    &:hover {
      transform: translateY(-4rpx);
    }
    
    .order-icon {
      position: relative;
      width: 80rpx;
      height: 80rpx;
      background: #f8f9fa;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      margin-bottom: 16rpx;
      
      .iconfont-v2 {
        font-size: 32rpx;
        color: #666;
      }
      
      .badge {
        position: absolute;
        top: -8rpx;
        right: -8rpx;
        background: #ED6567;
        color: white;
        font-size: 20rpx;
        font-weight: 600;
        width: 32rpx;
        height: 32rpx;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
      }
    }
    
    .order-label {
      font-size: 24rpx;
      color: #666;
    }
  }
}

/* 其他服务 */
.services-section {
  background: white;
  margin: 0 30rpx;
  border-radius: 24rpx;
  padding: 30rpx;
  
  .section-title {
    font-size: 32rpx;
    font-weight: 600;
    color: #333;
    margin-bottom: 30rpx;
    display: block;
  }
  
  .services-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30rpx;
    
    .service-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      cursor: pointer;
      transition: all 0.3s ease;
      
      &:hover {
        transform: translateY(-4rpx);
      }
      
      .service-icon {
        width: 80rpx;
        height: 80rpx;
        background: #f8f9fa;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-bottom: 16rpx;
        
        .iconfont-v2 {
          font-size: 32rpx;
          color: #666;
        }
      }
      
      .service-label {
        font-size: 24rpx;
        color: #666;
        text-align: center;
      }
    }
  }
}

/* 响应式适配 */
@media (max-width: 750rpx) {
  .user-info-section {
    padding: 30rpx 24rpx;
    
    .user-avatar-container .user-avatar {
      width: 100rpx;
      height: 100rpx;
    }
    
    .stats-container .stat-item .stat-number {
      font-size: 32rpx;
    }
  }
  
  .vip-section {
    margin: 0 24rpx 20rpx;
    padding: 24rpx;
  }
  
  .order-section {
    margin: 0 24rpx 20rpx;
    padding: 24rpx;
    
    .order-item .order-icon {
      width: 64rpx;
      height: 64rpx;
      
      .iconfont-v2 {
        font-size: 28rpx;
      }
    }
  }
  
  .services-section {
    margin: 0 24rpx;
    padding: 24rpx;
    
    .services-grid {
      gap: 24rpx;
      
      .service-item .service-icon {
        width: 64rpx;
        height: 64rpx;
        
        .iconfont-v2 {
          font-size: 28rpx;
        }
      }
    }
  }
}
</style>
